//
//  GSUtils.h
//  AgileNYC
//
//  Created by German on 26.05.14.
//  Copyright (c) 2014 Softlegion. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "SGSAppDelegate.h"

#define RGBA(r,g,b,a) [UIColor colorWithRed:r/255.f green:g/255.f blue:b/255.f alpha:a/255.f]

typedef enum {  GSLogInfo,
                GSLogWarning,
                GSLogError,
                GSLogEvent,
                GSLogSystem}
GSLogType;

//---------------------------------------------------

void GSLog(GSLogType logType, NSString * format, ...);

NSDate * getDateFromJSON (NSString* dateString);

int checkDateInRange(NSDate * startDate, NSDate * checkDate, NSDate * endDate);

CGSize labelSize(UILabel * label, CGFloat maxWidth, CGFloat maxHeight);

NSString * getFormattedPhoneNumber(NSString * phoneNumber);

NSString * getCurrentStoryBoardName();

#define weakself(ARGS) \
"weakself should be called as @weakself" @"" ? \
({  __weak typeof(self) _private_weakSelf = self; \
        ARGS { \
            __strong typeof(_private_weakSelf) self __attribute__((unused)) = _private_weakSelf; \
            return ^ (void) {

#define weakselfnotnil(ARGS) \
"weakself should be called as @weakself" @"" ? \
({  __weak typeof(self) _private_weakSelf = self; \
        ARGS { \
            __strong typeof(_private_weakSelf) self __attribute__((unused)) = _private_weakSelf; \
            return ^ (void) { if (self)

#define weakselfend \
        try {} @finally {} } (); }; \
}) : nil